<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="UTF-8"%>
<html>
  <head>
    <title>回收站删除信息</title>
  </head>
  
  <body>
   <%
		try {
			Class.forName("com.mysql.jdbc.Driver");
			String url1 = "jdbc:mysql://localhost:3306/user";
			String url2 = "?user=root&password=123456";
			String url3 = "&useUnicode=true&characterEncoding=UTF-8";
			String url = url1 + url2 + url3;
			Connection con = DriverManager.getConnection(url);
			request.setCharacterEncoding("UTF-8");
			String name = request.getParameter("name");
			String user = (String)session.getAttribute("user");
			String sql = "delete from recycle where name=? and user="+"'"+user+"'";
			PreparedStatement pstmt = con.prepareStatement(sql);
			pstmt.setString(1, name);
			int n = pstmt.executeUpdate();
			if (n == 1)
				out.print("删除成功" + "<br>");
			if (pstmt != null) {
				pstmt.close();
			}
			if (con != null) {
				con.close();
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
	%>
	<form action="recycle_delete.jsp" method="post">
		<h3 style="text-align: center;">删除信息</h3>
		<table style="margin: auto;">
			<tr>
				<td>name</td>
				<td><input type="text" name="name">
				</td>
			</tr>
			<tr>
				<td><input type="submit" value="提交"></td>
				<td><input type="reset" value="取消"></td>
			</tr>
		</table>
	</form>
  </body>
</html>
